FROM daocloud.io/library/python:3.6.2rc1-alpine

COPY . /home/django/

RUN echo https://mirrors.ustc.edu.cn/alpine/latest-stable/main > /etc/apk/repositories; \
    echo https://mirrors.ustc.edu.cn/alpine/latest-stable/community >> /etc/apk/repositories && \
    apk update && \
    apk add tzdata && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    apk del tzdata && \
    mkdir -p /usr/share/zoneinfo/Asia/Shanghai && \
    ln -s /etc/localtime /usr/share/zoneinfo/Asia/Shanghai && \
    apk add --no-cache gcc make libc-dev linux-headers && \
    apk add --no-cache nginx && \
    echo "daemon off;" >> /etc/nginx/nginx.conf && \
    mkdir -p /run/nginx/ && \
    mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak && \
    mv /home/django/config/nginx-app.conf /etc/nginx/conf.d/ && \
    pip3 install --upgrade pip --no-cache-dir -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host  mirrors.aliyun.com && \
    pip3 install django uwsgi --no-cache-dir -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host  mirrors.aliyun.com && \
    rm -rf ~/.cache/ && \
    rm -rf /root/.cache /tmp/* && \
    rm -rf /var/cache/apk/

ENV LC_ALL zh_CN.utf8

EXPOSE 80

CMD ["sh","/home/django/start.sh"]

